<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html class="win-frame">
<head>
<title>${name_china}管理-编辑${name_china}</title>
<%@include file="/common/head.jsp" %>

</head>
<body class="iframe-page">
<div class="page-title-wrapper">
    <div class="page-title">
        <div class="page-title-text">
            <span>${name_china}管理</span>
            <span class="split"></span>
            <span>编辑${name_china}</span>
        </div>
        <a id="goBack" class="btn-return distance-left" href="javascript:;"><i class="icon icon-arrow-left"></i>返回上级</a>
    </div>
    <div class="page-title-border"></div>
</div>

<form id="form" method="post">
    <div class="form-wrapper">
	  <div class="h4 distance-double">
        <span class="h4-title"><i class="icon icon-setting"></i>基本信息</span>
        <span class="h4-border"></span>
      </div>
      
      <input type="hidden" id="id" name="id"/> 
      <input type="hidden" id="orderNo" name="orderNo"/> 
      <input type="hidden" id="skuId" name="skuId"/>
	     
	     <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>订单号</p>
	        <input type="text" id="id" name="id" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div> 
	     
	     
	     <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>物流公司名称</p>
	        <input type="text" id="expressId" name="expressId" class="summer-input"/> 
	     </div>
	     
	       <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>物流号</p>
	        <input type="text" id="expressNo" name="expressNo" class="summer-input summer-validatebox"  data-validatebox="validType:['maxLength[50]']"/> 
	     </div>

     <div class="form-btn-wrapper" id="funcbar">
     <a class="btn btn-normal" id="saveBtn">保存</a>
        <a class="btn btn-normal" id="backBtn">关闭</a>
    </div>
  </div>
</form>
<script>
    
  var   editData,
        permission = CommonUtil.getPermission('${name_english}');
  //请求url
  var CONST_URL = {
  	INIT_ADD: basePath + "${common_url}initAdd",
	INIT_MAIN: basePath + "${common_url}init",
     	EDIT: basePath + "${common_url}edit"
  };
  
    $(function () {
    	editData = ${editData};
    	
    	//初始化funcbar
     	/* $('#funcbar').prepend($.funcbar({
            type: 'button',
            data: permission,
            permit: ['${name_english}:edit']
        })); */
        //T_PROJECT_EXPRESS_EXPRESS_COMPANY
         //下拉初始化
   	     //下拉初始化
   	    $('#expressId').combobox({
   	    	async:false,
   	        defaultValue: editData.expressId,
            valueField : 'code',
            textField : 'name',
            url : COMMON_URL.getCode + '?type=T_PROJECT_EXPRESS_EXPRESS_COMPANY'
        }); 
        
     	 // 新建toobar
		$.funcbar({
			id: 'toolbar',
			type: 'toolbar',
			data: permission,
			permit: ['${name_english}:initAdd']
		});
     	 $('#form').form({
        	onLoadSuccess:function(data){
               
           }
        }).form('loadDataEdit', {
            data: editData
        });

     	 //新建
         $('#toolbar').on('click', 'a[data-permit="${name_english}:initAdd"]', function() {
         	window.location.href = CONST_URL.INIT_ADD; 	  	
 		});
     	//保存按钮
     	$('#saveBtn').on('click', submit);
     	//返回按钮
    	$('#backBtn, #goBack').on('click',backMain);
     	
    });
    
  //返回主页面
    function backMain() {
    	window.location.href = CONST_URL.INIT_MAIN;
    }
    
    //表单提交
    function submit() {
         $("#form").form({
        	 //buttons : ['#saveBtn'],
             ajax: {
                 url: CONST_URL.EDIT
             },
             onSubmitSuccess: function (data) {
            	 $.stip({
   	                type:'ok',//显示类型 有info、 ok、 danger
   	                text: '保存成功！',
   	                onBeforeHide: function () {
   	                	if( typeof window.opener == 'object' && typeof window.opener.closeWindow=='function') {
   	                     window.opener.closeWindow(window, true); //不刷新 false
   	                 } 
   	                }
            	 });
              }
         }).form("submit");
    }
    
   
</script>
</body>
</html>